<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:composition template="layout.xhtml">
        
        <ui:define name="title">
            Campo do Ato
        </ui:define>

        <ui:define name="breadcrumb">
            <div class="breadcrumb_divider"></div>
            <a href="pesquisarAtoCampo.xhtml">Campo do Ato</a>
            <div class="breadcrumb_divider"></div>
            <a class="current">Pesquisar</a>
        </ui:define>

        <ui:define name="sidebar">
            <h3>Campo do Ato</h3>
            <ul class="toggle">
                <li class="icn_new_article"><a href="criarAtoCampo.xhtml">Cadastrar</a></li>
                <li class="icn_search"><a href="pesquisarAtoCampo.xhtml">Pesquisar</a></li>
            </ul>
       </ui:define>
        
        <ui:define name="content">           
            <h:form id="pesquisarAtoCampoForm">

                <p:panel id="pesquisarAtoCampoPanel" styleClass="column12">
                    <f:validateBean disabled="true">
                        <div class="row">
                            <div class="column2">
                                <p:outputLabel value="Nome" for="nomeInputText" />
                            </div>
                            <div class="column8">
                                <p:inputText id="nomeInputText" value="#{ managerPesquisarAtoCampo.atoCampoPesquisar.nome }" />
                            </div>
                        </div>
                    </f:validateBean>
                    <div class="command">
                        <p:commandButton
                            id="pesquisarcommandButton" value="Pesquisar" icon="ui-icon-search"
                            update="@form" actionListener="#{ managerPesquisarAtoCampo.pesquisar() }" />
                        <p:commandButton value="Limpar" icon="ui-icon-close" update="@form" actionListener="#{ managerPesquisarAtoCampo.limpar() }" />
                    </div>
                    
                    <p:dataTable id="atoCamposDataTable" var="atoCampo" value="#{ managerPesquisarAtoCampo.atoCampos }"
                        rows="5" paginator="true" paginatorPosition="bottom" emptyMessage="Nenhum registro encontrado">
                        
                        <p:column headerText="Opções" width="9%">
                            <div class="options3">
                                <p:button
                                    title="Editar" href="criarAtoCampo.xhtml?atoCampoId=#{ atoCampo.id }"
                                    icon="ui-icon-pencil"/>
                                <p:button
                                    title="Visualizar" href="visualizarAtoCampo.xhtml?atoCampoId=#{ atoCampo.id }"
                                    icon="ui-icon-search"/>
                                <p:commandButton title="Excluir" oncomplete="dialogApagar.show()" icon="ui-icon-trash">
                                    <f:setPropertyActionListener target="#{ managerPesquisarAtoCampo.atoCampoDeletar }" value="#{ atoCampo }" />
                                </p:commandButton>
                            </div>
                        </p:column>
                        
                        <p:column headerText="Nome" width="65%">
                            <h:outputText value="#{ atoCampo.nome }" />
                        </p:column>
                        <p:column headerText="Tipo" width="40%">
                            <h:outputText value="#{ atoCampo.tipo.nome }" />
                        </p:column>
                    </p:dataTable>

                </p:panel>
                
                <p:dialog header="Deseja realmente excluir?" widgetVar="dialogApagar" modal="true"
                          closable="false" resizable="false" draggable="false" >
                    <div class="commandDialog">
                        <p:commandButton value="Sim" update=":pesquisarAtoCampoForm:atoCamposDataTable"
                            oncomplete="dialogApagar.hide()" icon="ui-icon-check" actionListener="#{ managerPesquisarAtoCampo.deletar() }" />
                        <p:commandButton value="Não" icon="ui-icon-close" oncomplete="dialogApagar.hide()" />
                    </div>
                </p:dialog>

            </h:form>
        </ui:define>
    </ui:composition>
    
</html>